<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.model.Building" %>  
<%@ page import="com.control.BuildingControl" %>  
<%@ page import="java.util.ArrayList" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>insertInformation.jsp</title>
		<script language="javascript"> 
		var searchDefault="如：1990-01-01";   
	    var focusFlag = false;   
	    function inputFocus(e){   
	        if(e.value== searchDefault) {   
	            e.value='';   
	        }   
	        focusFlag = true;   
	        e.style.color="black";   
	    }   
	function inputBlur(e){   
	        if(e.value=='') {   
	            e.value=searchDefault;   
	    e.style.color="#767676";   
	        }   
	    }   
		function check1()
		{
			    if(document.form1.number.value=="")
				{
					alert("账号不能为空");
					document.form1.name.focus();
					return;
				}
				else if(document.form1.name.value=="")
				{
					alert("姓名不能为空");
					document.form1.number.focus();
					return;
				}
				else if(document.form1.password.value=="")
				{
					alert("密码不能为空");
					document.form1.password.focus();
					return;
				}
				else
				{form1.submit();}
		}
</script>
	</head>
	<body>
		<fieldset class="filedset">
			<legend>
				添加学生信息
			</legend>
			<form action="student_insert_deal.jsp" name="form1" method="post"
				style="margin-top: 20px; margin-left: 400px;">
				<span style="color: #376ba5; margin-top: 10px;">学&nbsp;&nbsp;号：</span>
				<input name="number" type="text" id="number"
					style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">密&nbsp;&nbsp;码：</span>
				<input name="password" type="text" id="password"
					 style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">姓&nbsp;&nbsp;名：</span>
				<input name="name" type="text" id="name" 
					style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">性&nbsp;&nbsp;别：</span> 
				<select name="sex" id="sex" style="margin-top:10px"><option value="男">男</option><option value="女">女</option></select>	
				<br />
				<span style="color: #376ba5; margin-top: 10px;">生&nbsp;&nbsp;日：</span>
				<input name="birth" type="text" id="birth"  onfocus="inputFocus(this)" onblur="inputBlur(this)" value="如：1990-01-01"
					style="margin-top: 10px;">
				<br />
				<span style="color: #376ba5; margin-top: 10px;">手机号：</span>
				<input name="tel" type="text" id="tel"
					style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">寝室长：</span>
				 	<input type = "radio" style="margin-top: 10px;" value = true  name = "leader" />是
   				 	<input type = "radio" style="margin-top: 10px;" value = false  name = "leader"  checked="checked"/>否
   				<br />
				<span style="color: #376ba5; margin-top: 10px;">学&nbsp;&nbsp;院：</span>
				<input name="college" type="text" id="college"
					 style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">专&nbsp;&nbsp;业：</span>
				<input name="major" type="text" id="major"
					 style="margin-top: 10px;">*
				<br />
				<span style="color: #376ba5; margin-top: 10px;">寝&nbsp;&nbsp;室：</span>
				<select name="building" size="1"  style="margin-top: 10px;">
										<%
											BuildingControl control = new BuildingControl();
											ArrayList<Building> list = new ArrayList<Building>();
											list = control.getBuildingList(); 
											for(int i=0; i<list.size(); i++) {
												Building building = list.get(i);
										%>
										<option value="<%= building.getBuilding_id() %>"><%=building.getBuilding_name() %></option>
										<%}%>
										</select><input name="dorm" type="text" id="dorm" size="9"
					 style="margin-top: 10px;">*
				<br />
				<input type="submit" value="确定" onclick="check1()"
					style="background: url(../../images/button.gif) no-repeat; margin-left: 40px; border: 0px; height: 28px; width: 62px; margin-top: 20px;" />
				<input name="input" type="reset" value="重置"
					style="background: url(../../images/button.gif) no-repeat; margin-left: 20px; border: 0px; height: 28px; width: 62px; margin-top: 20px;" />
			</form>
		</fieldset>
	</body>
</html>